<% if current_government.official_user_id == user.id %>
	<div class="heading"><%= t('charts.user.name', :user_name => current_government.official_user_short_name) %></div>
<% else %>
	<div class="heading"><%= t('charts.user.name', :user_name => user.name) %></div>
<% end %>

<% cache("user_priority_chart-#{user.id.to_s}-#{user.endorsements_count.to_s}") do %> 
<% cu = user.index_chart_hash %>
<div class="priority_chart">
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td valign="top" rowspan="3" colspan="3">
			<%= image_tag Gchart.line(:size => '130x80', :data => cu[:adjusted_percentages], :line_colors => "13499b", :chart_background => 'EEEEEE', :min_value => 0, :max_value => cu[:max_percentage]*2, :custom => "chg=0,50,1,0"), :title => t('charts.user.title', :user_name => user.name), :class => "qtip_left", :size => "130x80" %>
		</td>			
		<td valign="top" class="chart_label_plus" height="17">+<%= number_to_percentage(cu[:max_percentage]*100, :precision => 2) %></td>

	</tr>
	<tr><td valign="middle" class="chart_label" height="47">0</td></tr>
	<tr><td valign="bottom" class="chart_label_minus" height="15"><%= number_to_percentage(cu[:max_percentage]*-100, :precision => 2) %></td></tr>
	</tr>
	<% if current_government.official_user_id == user.id %>
	
		<%= render :partial => "shared/total_volume_chart" %>
	
	<% else %>
		<tr><td colspan="3" style="padding-top: 5px; padding-bottom: 2px;"><%= t('charts.priority.volume.name')%></td><td></td></tr>		
		<tr>
			<td valign="top" rowspan="3" colspan="3">
				<%= image_tag Gchart.line(:size => '130x50', :data => [cu[:volume_counts],[0,0]], :bar_colors => "CCCCCC,EEEEEE",  :chart_background => 'EEEEEE', :min_value => 1, :max_value => cu[:max_volume], :custom => "chm=b,CCCCCC,0,1,0|b,CC0000,1,2,0&chls=1,1,0|1,1,0|0,1,-1&chg=17,50,1,5"), :title => t('charts.priority.total_volume.title'), :size => "130x50" %>			
			</td>			
			<td valign="top" class="chart_label" height="17"><%= cu[:max_volume] %></td>
		</tr>
		<tr><td valign="middle" class="chart_label" height="17"><%= (cu[:max_volume]*0.5).to_i %></td></tr>
		<tr><td valign="bottom" class="chart_label" height="16">1</td></tr>
	<% end %>
	<tr>
		<td style="padding-top: 2px;"><%= cu[:charts].last.date_show %></td>
		<td align="center" style="padding-top: 2px;"><%= cu[:charts][(cu[:charts].size/2).to_i].date_show %></td>
		<td align="right" style="padding-top: 2px;"><%= cu[:charts].first.date_show %></td>
		<td></td>
	</tr>	
</table>
</div>
<% end %>